$def with (page=None)

$ bodyid = ctx.get('bodyid', 'user')

<div class="clearfix"></div>

$if bodyid == 'user' or 'admin':
    $if ("stats" in ctx.features) and query_param('debug'):
        $:render_template("site/stats")
    $:render_template("lib/nav_foot", page)

</body>
    <script src="$static_url('build/all.js')" type="text/javascript"></script>
    <!-- Must be loaded after jquery -->
    <script src="//archive.org/includes/analytics.js?v=0c15bbe" type="text/javascript"></script>
    $:render_template('lib/analytics', page)

    <script>
    //anonymized analytics
    window.addEventListener('DOMContentLoaded', function send_analytics_pageview() {
        archive_analytics.send_pageview({});
    });
    </script>

    $if any([path in request.canonical_url for path in ['/account/create', '/books/add', '/edit', '/books', '/contact']]):
        <!-- Must be loaded in Sign Up and Add new Books page -->
        <!-- Must be loaded for all edit pages having link /books/*/*/edit -->
        <script src="https://www.google.com/recaptcha/api.js" async defer></script>

    <!-- clear the window.q and setup the jQuery plugins -->
    <script>
    \$( function () {
        var i;
        for ( i = 0; i < window.q.length; i++ ) {
            \$( window.q[i] );
        }
        window.q = [];
    } );

    if (typeof archive_analytics !== 'undefined') {
      archive_analytics.set_up_event_tracking();
    }
    </script>
</html>
